import request from '@/config/axios'

// 品类 VO
export interface CategoryVO {
  id: number // 编号
  name: string // 品类名称
  tags: string // 标签
}

// 品类 API
export const CategoryApi = {
  // 查询品类分页
  getCategoryPage: async (params: any) => {
    return await request.get({ url: `/system/category/page`, params })
  },

  // 查询品类详情
  getCategory: async (id: number) => {
    return await request.get({ url: `/system/category/get?id=` + id })
  },

  // 新增品类
  createCategory: async (data: CategoryVO) => {
    return await request.post({ url: `/system/category/create`, data })
  },

  // 修改品类
  updateCategory: async (data: CategoryVO) => {
    return await request.put({ url: `/system/category/update`, data })
  },

  // 删除品类
  deleteCategory: async (id: number) => {
    return await request.delete({ url: `/system/category/delete?id=` + id })
  },

  // 导出品类 Excel
  exportCategory: async (params) => {
    return await request.download({ url: `/system/category/export-excel`, params })
  },
  // 精简列表
  getSimpleCategoryList: async () => {
    return await request.get({ url: `/system/category/simple-list` })
  }
}
